using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SensorVisual
{
    public partial class Joystick : Form
    {
        private ControlSancho m_sancho;
        private int m_vIzq;
        private int m_vDcha;

        public ControlSancho Sancho
        {
            get { return m_sancho; }
            set { m_sancho = value; }
        }

        public Joystick()
        {
            InitializeComponent();

            m_sancho = new ControlSancho();
            m_vIzq = 0;
            m_vDcha = 0;
        }

        private void buttonParar_Click(object sender, EventArgs e)
        {
            m_vIzq = 0;
            m_vDcha = 0;
            m_sancho.SetSpeed(m_vIzq, m_vDcha);
        }

        private void buttonAvanzar_Click(object sender, EventArgs e)
        {
            m_vIzq += 10;
            m_vDcha += 10;
            m_sancho.SetSpeed(m_vIzq, m_vDcha);
        }

        private void buttonRetroceder_Click(object sender, EventArgs e)
        {
            m_vIzq -= 10;
            m_vDcha -= 10;
            m_sancho.SetSpeed(m_vIzq, m_vDcha);
        }

        private void buttonIzquierda_Click(object sender, EventArgs e)
        {
            m_vIzq -= 10;
            m_vDcha += 10;
            m_sancho.SetSpeed(m_vIzq, m_vDcha);
        }

        private void buttonDerecha_Click(object sender, EventArgs e)
        {
            m_vIzq += 10;
            m_vDcha -= 10;
            m_sancho.SetSpeed(m_vIzq, m_vDcha);
        }

    }
}